package com.study.selection.service;

import com.study.selection.dao.CollegeDao;
import com.study.selection.model.College;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CollegeServiceImpl implements CollegeService {

    @Autowired
    private CollegeDao collegeDao;

    @Override
    public List<College> findAll() {
        return collegeDao.findAll();
    }

    @Override
    public List<College> findByKey(String key) {
        return collegeDao.findByKey(key);
    }

    @Override
    public boolean addCollege(College college) {
        return collegeDao.addCollege(college) > 0 ? true : false;
    }

    @Override
    public College getById(int collegeId) {
        return collegeDao.getById(collegeId);
    }

    @Override
    public boolean updateCollege(College college) {
        return collegeDao.updateCollege(college) > 0 ? true : false;
    }
    @Override
    public boolean deleteCollege(int collegeId) {
        return collegeDao.deleteCollege(collegeId) > 0 ? true : false;
    }


}
